package g2.routemaster.gui.actions;

import g2.routemaster.gui.GManager;
import g2.routemaster.gui.wizards.ScoringWizard;
import g2.routemaster.model.GameManager;
import g2.routemaster.model.Player;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.jface.wizard.WizardDialog;

public class ScoringAction extends Action {
   private ApplicationWindow window;
   public ScoringAction(ApplicationWindow window) {
      this.window = window;
      setText("Score");
      setToolTipText("Scoring route");
   }

   public void run() {
      GameManager gm = GManager.instance().getGameManager();
      Player player = gm.getTurnManager().getPlayer();
      
      // Instantiates and initializes the wizard
      ScoringWizard wizard = new ScoringWizard();
      wizard.setPlayer(player);
      
      // Instantiates the wizard container with the wizard and opens it
      WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
      dialog.create();
      dialog.open();
   }
}
